package cn.worldyao.demo.service.impl;

import cn.worldyao.demo.entity.SysUser;
import cn.worldyao.demo.entity.SysUserRole;
import cn.worldyao.demo.mapper.SysUserMapper;
import cn.worldyao.demo.service.SysUserRoleService;
import cn.worldyao.demo.service.SysUserService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * <p>
 * 服务实现类
 * </p>
 *
 * @author yaozi
 * @since 2020-03-11
 */
@Service
public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> implements SysUserService {

    @Autowired
    private SysUserRoleService sysUserRoleService;

    @Override
    public boolean save(SysUser entity) {
        entity.Init();
        SysUserRole userRole = new SysUserRole();
        userRole.setUid(entity.getUid());
        userRole.setRid("nDqpJXHi");
        return (sysUserRoleService.save(userRole)) ? super.save(entity) : false;
    }
}
